package com.yulongtian.weekCompetition.month202211.week4;

/**
 * @author yulongTian
 * @create 2022-11-27 10:54
 */
public class Test02 {
    public static void main(String[] args) {
        String s = "z";
        String t = "abcde";
        System.out.println(appendCharacters(s, t));
    }

    public static int appendCharacters(String s, String t) {
        int tIndex = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) == t.charAt(tIndex)) {
                tIndex++;
                if (tIndex == t.length()) {
                    return 0;
                }
            }
        }


        return t.length() - tIndex;
    }
}
